package Thread;
class Mythread extends Thread{
   @Override
    public void run(){
       try {
           while (true){
               Thread.sleep(1000);
               System.out.println("hello thread!");
           }
       } catch (InterruptedException e) {
           e.printStackTrace();
       }
   }
}
public class Dom1 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Mythread();
        //真正在系统当中创建一个线程
        t.start();
        while (true){
            Thread.sleep(1000);
            System.out.println("hello main!");
        }
    }
}
